<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>图片缩放</title>
    <script src="./js/jquery-3.7.1.min.js"></script>
</head>
<body>
    <img src="../pic/rose.jpg" alt="我是一个图片" width="200"><br/>
    <div>
        <span><input type="button" id="button1" value="放大"></span>
        <span><input type="button" id="button2" value="缩小"></span>
    </div>
    <script>
        let w = 0;
        w = $("img").attr("width");
        $("#button1").click(function() {
            w = w*1 + 100*1;
            console.log(w);
            $("img").attr("width", w);
        });
        $("#button2").click(function() {
            w = w - 100;
            console.log(w);
            $("img").attr("width", w);
        });
    </script>
</body>
</html>